package com.gitee.vincentzyu.qwq_forge189.inventory;

import com.gitee.vincentzyu.qwq_forge189.QwqForge189;
import com.gitee.vincentzyu.qwq_forge189.client.gui.GuiAchievementContainer;
import com.gitee.vincentzyu.qwq_forge189.client.gui.GuiContainerDemo;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.IGuiHandler;
import net.minecraftforge.fml.common.network.NetworkRegistry;

public class GuiElementLoader implements IGuiHandler {
    public static final int GUI_DEMO = 1;
    public static final int ACHIEVEMENT_GUI = 2;

    public GuiElementLoader(){
        NetworkRegistry.INSTANCE.registerGuiHandler(QwqForge189.instance, this);
    }

    @Override
    public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z){
        switch (ID){
            case GUI_DEMO:
                return new ContainerDemo(player);
            case ACHIEVEMENT_GUI:{
                EntityPlayerMP playerMP = (EntityPlayerMP) player;
                return new AchievementContainer(player, playerMP.getStatFile());
            }
            default:
                return null;
        }
    }

    @Override
    public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
        switch (ID){
            case GUI_DEMO:
                return new GuiContainerDemo(new ContainerDemo(player));
            case ACHIEVEMENT_GUI:{
                EntityPlayerMP playerMP = (EntityPlayerMP) player;
                return new GuiAchievementContainer(new AchievementContainer(player, playerMP.getStatFile()));
            }
            default:
                return null;
        }
    }

}
